package com.cx.service.lq.Impl;

import com.cx.mapper.EvaluateMapper;
import com.cx.pojo.Evaluate;
import com.cx.service.lq.EvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.soap.Text;
import java.util.Date;
import java.util.List;

@Service
public class EvaluateServiceImpl implements EvaluateService {
    @Autowired
    EvaluateMapper evaluateMapper;

    @Override
    public int addEvaluate(int gameId, int userId, int evaluateLevel, String evaluateContent) {
        Evaluate evaluate = new Evaluate();
        Date date = new Date();
        evaluate.setGameId(gameId);
        evaluate.setEvaluateLevel(evaluateLevel);
        evaluate.setUserId(userId);
        evaluate.setEvaluateContent(evaluateContent);
        evaluate.setEvaluateTime(date);
        int affect = evaluateMapper.insert(evaluate);
        return affect;
    }

    @Override
    public List<Evaluate> selectAll(int gameId) {
        List<Evaluate> evaluates = evaluateMapper.selectAll(gameId);
        return evaluates;
    }
}
